package com.software.graduationproject.modules.comment.entity;

import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.v2coding.mybatis.model.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;

/**
 * Comment : 评论表
 * ---------------------------------------------------------------------------------------------------------------------
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("comment")
@ApiModel(value = "Comment", description = "评论表")
public class Comment extends BaseModel<Comment> {

    @TableField(value ="user_id")
    @ExcelProperty(value = "用户ID")
    @ApiModelProperty(value = "用户ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户ID不能为空")
    private Long userId;

    @TableField(value ="nick_name")
    @ExcelProperty(value = "用户昵称")
    @ApiModelProperty(value = "用户昵称")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "用户昵称长度不能超过255")
    private String nickName;

    @TableField(value ="shopping_cart_id")
    @ExcelProperty(value = "购物车ID")
    @ApiModelProperty(value = "购物车ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "购物车ID不能为空")
    private Long shoppingCartId;

    @TableField(value ="evaluate_content")
    @ExcelProperty(value = "评论内容")
    @ApiModelProperty(value = "评论内容")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "评论内容长度不能超过255")
    private String evaluateContent;

    @TableField(value ="rate_value")
    @ExcelProperty(value = "评分")
    @ApiModelProperty(value = "评分")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "评分不能为空")
    private Integer rateValue;

    @TableField(value ="like_count")
    @ExcelProperty(value = "点赞（1：赞 -1：踩）")
    @ApiModelProperty(value = "点赞（1：赞 -1：踩）")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "点赞（1：赞 -1：踩）不能为空")
    private Integer likeCount;


    @TableField(value ="order_id")
    @ExcelProperty(value = "订单ID")
    @ApiModelProperty(value = "订单ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "订单ID不能为空")
    private Long orderId;

}
